#-*- coding: UTF-8 -*-
import re
import os
import readtar
import devU
import toexcel
import utable
import mpath

def delselect(ex_s_delivery_list,list_profiles):
	querya = {}

	deliverytimestr = input('输入发版日期（格式YYYY-MM-DD）（不作输入则默认导出全部日期）：')
	if deliverytimestr =='':
		pass
	else:
		querya['deliverytime'] = deliverytimestr
	ex_s_delivery_list1 = utable.pbSDeliverylist(ex_s_delivery_list,querya)
	
	list_work_profilesid = utable.getquekey(ex_s_delivery_list1,'profilesid')
	for i in range(len(list_work_profilesid)):
		print(i,'--->',list_profiles[list_work_profilesid[i]])
	profilesidstr = input('输入环境序号（不作输入则默认导出全部环境）：')
	if profilesidstr == '':
		pass
	elif int(profilesidstr) >= len(list_work_profilesid):
		print("该序号不在列表中，将按默认执行")
	else:
		querya['profilesid'] = list_work_profilesid[int(profilesidstr)]
	ex_s_delivery_list2 = utable.pbSDeliverylist(ex_s_delivery_list,querya)
	
	
	list_work_packtime = utable.getquekey(ex_s_delivery_list2,'packtime')
	for i in range(len(list_work_packtime)):
		print(i,'--->',list_work_packtime[i])
	packtimestr = input('输入版本序号（不作输入则默认导出全部版本）：')
	if packtimestr =='':
		pass
	elif int(packtimestr) >= len(list_work_packtime):
		print("该序号不在列表中，将按默认执行")
	else:
		querya['packtime'] = list_work_packtime[int(packtimestr)]
	
	ex_s_delivery_list_query = utable.pbSDeliverylist(ex_s_delivery_list2,querya)
	
	
	return ex_s_delivery_list_query